import request from '@/utils/request';
import { _Competition, Competition } from '@/api/model/Competition';
import { R } from '@/api/model/R';




// 获取我负责点评的比赛
export function getMyJudgementCompetitionList(query?: _Competition): Promise<R<Competition>> {
    // eslint-disable-next-line @typescript-eslint/ban-ts-comment
    // @ts-ignore
    return request({
        url: '/business/competition/getMyJudgementCompetitionList',
        method: 'get',
        params: query
    });
}

// 查询比赛列表
export function listCompetition(query?: _Competition): Promise<R<Competition>> {
    // eslint-disable-next-line @typescript-eslint/ban-ts-comment
    // @ts-ignore
    return request({
        url: '/business/competition/list',
        method: 'get',
        params: query
    });
}

// 查询我参加比赛的列表
export function myJoinCompetition(query?: _Competition): Promise<R<Competition>> {
    // eslint-disable-next-line @typescript-eslint/ban-ts-comment
    // @ts-ignore
    return request({
        url: '/business/competition/my',
        method: 'get',
        params: query
    });
}


// 查询比赛详细
export function getCompetition(competitionId: number | string): Promise<R<Competition>> {
    // eslint-disable-next-line @typescript-eslint/ban-ts-comment
    // @ts-ignore
    return request({
        url: '/business/competition/' + competitionId,
        method: 'get'
    });
}

// 报名比赛
export function signCompetition(competitionId: number | string): Promise<R<string>> {
    // eslint-disable-next-line @typescript-eslint/ban-ts-comment
    // @ts-ignore
    return request({
        url: '/business/competitionSign',
        method: 'post',
        data: { competitionId }
    });
}

// 获取比赛报名状态
export function isSign(competitionId: number | string): Promise<R<boolean>> {
    // eslint-disable-next-line @typescript-eslint/ban-ts-comment
    // @ts-ignore
    return request({
        url: `/business/competitionSign/status/${competitionId}`,
        method: 'get'
    });
}
